<template>
  <div>
    <div v-if="type === 'back'" class="tTitle-box-r">
      <a-icon type="left" class="icon" @click="$router.go(-1)" />
      <strong>{{ tit }}</strong>
    </div>
    <div v-else-if="type === 'center'" class="tTitle-box-c">
      <strong>{{ tit }}</strong>
    </div>
    <div class="tTitle-box" v-else>
      <div class="tTitle-l">
        <a-tooltip placement="bottom">
          <template slot="title">
            <span>{{ tit }}</span>
          </template>
          <div class="tTitle-l-tit">{{ tit }}</div>
        </a-tooltip>

        <div class="tTitle-l-desc">
          <slot name="left"></slot>
        </div>
      </div>
      <div class="tTitle-r">
        <slot name="right"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    type: {
      type: String,
      default: ""
    },
    tit: {
      type: String,
      default: ""
    }
  }
};
</script>

<style lang="scss" scoped>
.tTitle-box {
  display: flex;
  justify-content: space-between;
  .tTitle-l {
    line-height: 26px;
    font-size: 18px;
    font-weight: 500;
    color: #3c3d43;
    display: flex;
    .tTitle-l-tit {
      margin-right: 26px;
      max-width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .tTitle-l-desc {
      font-size: 14px;
      font-weight: 400;
      color: #767885;
    }
  }
}
.tTitle-box-r {
  height: 60px;
  line-height: 60px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 18px;
  font-weight: 500;
  color: #3c3d43;
  text-align: center;
  position: relative;
  .icon {
    position: absolute;
    top: 24px;
    left: 14px;
  }
}
.tTitle-box-c {
  height: 60px;
  line-height: 60px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 18px;
  font-weight: 500;
  color: #3c3d43;
  text-align: center;
}
</style>
